import request from '@/utils/request'

// 列表
export function listNews(query) {
    return request({
        url: '/officialWebsite/photoalbum/list',
        method: 'get',
        params: query
    })
}

export function getNews(newsId) {
    return request({
        url: '/officialWebsite/photoalbum/' + newsId,
        method: 'get'
    })
}

export function addNews(data) {
    return request({
        url: '/officialWebsite/photoalbum/saveOrUpdate',
        method: 'post',
        data: data
    })
}


export function updateNews(data) {
    return request({
        url: '/officialWebsite/photoalbum/saveOrUpdate',
        method: 'post',
        data: data
    })
}

export function updatePic(data) {
    return request({
        url: '/officialWebsite/photoalbum/pic/saveOrUpdate',
        method: 'post',
        data: data
    })
}

// 删除新闻
export function delNews(newsId) {
    return request({
        url: '/officialWebsite/photoalbum/delete-by-id',
        method: 'get',
        params: { "id": newsId }
    })
}

export function delNewsByIds(newsIds) {
    return request({
        url: '/officialWebsite/news/delete-by-ids',
        method: 'get',
        params: { "ids": newsIds }
    })
}


export function delPic(newsId) {
    return request({
        url: '/officialWebsite/photoalbum/pic/delete-by-id',
        method: 'get',
        params: { "id": newsId }
    })
}